package com.sky.context;

public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<Long>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }// 在拦截器中设置当前线程的id为当前登入用户的id

    public static Long getCurrentId() {
        return threadLocal.get();
    }
    //在service层中获取当前线程的id(即当前登入用户的id)

    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
